import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HelpInfoVO, HelpInfoForm, HelpInfoQuery } from '@/api/help/types';

/**
 * 查询用户设备列表
 * @param query
 * @returns {*}
 */
export const getHelpInfoList = (query?: HelpInfoQuery): AxiosPromise<HelpInfoVO[]> => {
  return request({
    url: '/system/helpInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 获取用户设备详细信息
 * @param id
 */
export const getHelpInfoDetail = (id: string | number): AxiosPromise<HelpInfoVO> => {
  return request({
    url: '/system/helpInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增用户设备
 * @param data
 */
export const addHelpInfo = (data: HelpInfoForm) => {
  return request({
    url: '/system/helpInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户设备
 * @param data
 */
export const updateHelpInfo = (data: HelpInfoForm) => {
  return request({
    url: '/system/helpInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除测试单
 * @param id
 */
export const deleteHelpInfo = (ids: string | number | Array<string | number>) => {
  return request({
    url: '/system/helpInfo/' + ids,
    method: 'delete'
  });
};
